# -*- coding: utf-8

from zipfile import ZipFile

CONTENT_FILE="content.xml"

def open_xmind(filename):
  """open xmind file and pick up 'content.xml'
     input: filename
     output: file handle for content.xml
  """
  
  if filename.endswith( '.xml' ):
    hFile = open( filename, "r" )
  else:
    zFile = ZipFile( filename, "r" )
    hFile = zFile.open( CONTENT_FILE, "r" )

  return hFile

if __name__=='__main__':
  # test routine
  h = open("design.xmind")
  try:
    for line in h:
      print ">>", line
  finally:
    h.close()
